@extends('admin.app')

@section('content')
  <div class="panel panel-default">
    <div class="panel-heading font-bold">
      代码类别信息列表
    </div>
    <div class="row wrapper">
      <div class="col-sm-4">
        <form action="{{ admin_action('System\CodeTypesController@index') }}">
          <div class="input-group">
            <input type="text" class="input-sm form-control" name="search" value="{{ $query['search'] ?? '' }}" placeholder="请输入查询条件">
            <span class="input-group-btn">
              <button class="btn btn-sm btn-default" type="submit">查询</button>
            </span>
          </div>
        </form>
      </div>
      <div class="col-sm-8 text-right text-center-xs">
        <a class="btn m-b-xs btn-sm btn-default btn-addon" href="{{ admin_action('System\CodeTypesController@create') }}">
          <i class="fa fa-plus"></i>新增代码类别
        </a>
      </div>
    </div>
    <div class="table-responsive">
      <table class="table table-striped b-t b-light">
        <thead>
          <tr>
            <th>#ID</th>
            <th>名称</th>
            <th class="hidden-xs">描述</th>
            <th>操作</th>
          </tr>
        </thead>
        <tbody>
          @forelse ($codeTypes as $codeType)
          <tr>
            <td><a class="btn-link" href="{{ admin_action('System\CodesController@index', [$codeType]) }}" data-toggle="tooltip" title="查询代码信息">{{ $codeType->id }}</a></td>
            <td>{{ $codeType->name }}</td>
            <td class="hidden-xs">{{ $codeType->description }}</td>
            <td>
              <a class="btn btn-xs btn-primary" href="{{ admin_action('System\CodeTypesController@edit', [$codeType]) }}" data-toggle="tooltip" title="编辑代码类别信息">
                <i class="fa fa-pencil"></i>
              </a>
              <form class="inline" action="{{ admin_action('System\CodeTypesController@destroy', [$codeType]) }}" method="post">
                {{ csrf_field() }}
                {{ method_field('DELETE') }}
                <button type="button" data-swal-role="delete-confirm" class="btn btn-xs btn-danger" data-toggle="tooltip" title="删除代码类别信息">
                  <i class="fa fa-trash-o"></i>
                </button>
              </form>
            </td>
          </tr>
          @empty
          <tr>
            <td colspan="4" class="text-center">没有找到代码类别记录</td>
          </tr>
          @endforelse
        </tbody>
      </table>
    </div>
    <div class="panel-footer">
      <div class="row">
        <div class="col-sm-12 text-right text-center-xs">                
          {{ $links }}
        </div>
      </div>
    </div>
  </div>
@endsection